/*
 * Address.java
 *
 * Created on March 17, 2007, 8:56 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package ge.info.domain;

import ge.ktools.StringUtils;
import java.util.List;

/**
 * @author Administrator
 */
public class Address implements java.io.Serializable
{

    private Integer cityID;
    private CityRegion cityRegion;
    private String streetName;
    private Integer streetID;
    private String suffix;
    private String district;
    private Integer countryID;
    private int hidden = 0;


    public Address()
    {
    }

    public int getIncludeInSearch()
    {
        if (cityID != null && !cityID.equals(0))
        {
            return 1;
        }
        if (getCityRegion() != null && getCityRegion().getRegionID() != null && !getCityRegion().getRegionID().equals(0))
        {
            return 1;
        }
        if (getStreetName() != null)
        {
            return 1;
        }
        return 0;
    }

    public Integer getCityID()
    {
        return cityID;
    }

    public void setCityID(Integer cityID)
    {
        this.cityID = cityID;
    }

    public String getSuffix()
    {
        return suffix;
    }

    public void setSuffix(String suffix)
    {
        this.suffix = suffix;
    }

    public String getDistrict()
    {
        return district;
    }

    public void setDistrict(String district)
    {
        this.district = district;
    }

    public Integer getCountryID()
    {
        return countryID;
    }

    public void setCountryID(Integer countryID)
    {
        this.countryID = countryID;
    }

    public int getHidden()
    {
        return hidden;
    }

    public void setHidden(int hidden)
    {
        this.hidden = hidden;
    }

    public String getStreetName()
    {
        return streetName;
    }

    public void setStreetName(String streetName)
    {
        this.streetName = streetName;
    }

    public CityRegion getCityRegion()
    {
        if (cityRegion == null)
        {
            cityRegion = new CityRegion();
            cityRegion.setRegionID(0);
            cityRegion.setCityID(cityID);
        }
        return cityRegion;
    }

    public void setCityRegion(CityRegion cityRegion)
    {
        this.cityRegion = cityRegion;
    }

    public Integer getStreetID()
    {
        return streetID;
    }

    public void setStreetID(Integer streetID)
    {
        this.streetID = streetID;
    }

    public List<String> getStreetNames()
    {
        return StringUtils.splitString(streetName);
    }

    public List<String> getSuffixes()
    {
        return StringUtils.splitString(suffix);
    }

}
